home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
mutt
/
fact.mut
< prev
next >
Wrap
Text File
|
1988-03-01
|
330b
|
18 lines
; Factorial the recursive way
(defun
fact (int n) HIDDEN ; the recursive part. input: n output: n!
{
(if (== n 0) 1 ; 0! = 1
(* n (fact (- n 1))) ; n! = n * (n-1)!
)
}
! ; the main routine
{
(int n)
(n (atoi (ask "Take factorial of: ")))
(msg n "! = " (fact n))
}
)
(!)